package com.huike.web.controller.clues;


import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.TbCourse;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.clues.service.impl.TbClueTrackRecordServiceImpl;
import com.huike.common.annotation.Log;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.page.TableDataInfo;
import com.huike.common.enums.BusinessType;
import com.huike.common.utils.DateUtils;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 线索跟进记录Controller
 *
 * @date 2021-04-22
 */
@RestController
@RequestMapping("/clues/record")
public class TbClueTrackRecordController extends BaseController {

    //自动注入接口ITbClueTrackRecordService
    @Autowired
    private ITbClueTrackRecordService tbClueTrackRecordService;

    // 查询线索跟进记录列表
    @PreAuthorize("@ss.hasPermi('clues:record:list')")
    @GetMapping("/list")
    public AjaxResult list(@RequestParam("clueId") Long clueId) {

        return AjaxResult.success(tbClueTrackRecordService.findByid(clueId));
    }

    //线索跟进记录
    //权限
    @PreAuthorize("@ss.hasPermi('clues:record:add')")
    //日志
    @Log(title = "线索跟进记录", businessType = BusinessType.INSERT)
    @PostMapping
    //添加方法,传入参数
    public AjaxResult add(@RequestBody ClueTrackRecordVo TbClueTrackRecordvo) {
        //把参数传到service
        tbClueTrackRecordService.addClueTrackRecordVo(TbClueTrackRecordvo);
        //无返回值,直接返回 操作成功
        return AjaxResult.success("操作成功");
    }
}
